<template>
  <content-field>
    <n-card
      ><n-space>
        <!-- <badge-index-card /> -->
        <n-button>同步</n-button
        ><n-button @click="to_article_edit(-1)">创建文章</n-button
        ><n-button @click="to_essay_edit(-1)">创建动态</n-button>
        <n-button @click="createBadge">创建标签</n-button>
        <n-button @click="showBadgeContent">展示标签所属页</n-button>
        <n-button @click="showCollectionContent">展示集合所属页</n-button>
      </n-space>
      <user-login-view />
      <collection-list-view />
      <badge-list-view />

      <badge-edit-view ref="badgeCreate" :id="-1" />
    </n-card>
  </content-field>
</template>

<script>
import ContentField from "@/components/ContentField.vue";
import { useRouter } from "vue-router";
import BadgeEditView from "./edit/BadgeEditView.vue";
import { ref } from "@vue/reactivity";
import BadgeListView from "./list/BadgeListView.vue";
import CollectionListView from "./list/CollectionListView.vue";
import routerJump from "@/composables/RouterJump";
import UserLoginView from "./UserLoginView.vue";

// import axios from "axios";

export default {
  components: {
    ContentField,
    BadgeEditView,
    BadgeListView,
    CollectionListView,
    UserLoginView,
  },

  setup() {
    const router = useRouter();

    const badgeCreate = ref(null);

    const { to_article_edit, to_essay_edit } = routerJump();

    const createBadge = () => {
      badgeCreate.value.showModal = true;
    };
    const showBadgeContent = () => {
      router.push({
        name: "BadgeContentView",
        params: {
          id: 5,
          type: "article",
        },
      });
    };
    const showCollectionContent = () => {
      router.push({
        name: "CollectionContentView",
        params: {
          id: 10,
          type: "article",
        },
      });
    };
    return {
      to_article_edit,

      createBadge,
      badgeCreate,
      showBadgeContent,
      showCollectionContent,
      to_essay_edit,
    };
  },
};
</script>

<style>
</style>